﻿@model AspNetPaging.PagingModel
@if (Model.PageCount > 1)
{
    var links = Model.GetPageIndexs();
    <ul class="pagination">
        @if (Model.HasPrev)
        {
            <li><a href="@Model.GetPrevUrl()">@Model.Prev</a></li>
        }
        @if (Model.Page - 1 != 1 && !links.Any(o => o == 1))
        {
            <li><a href="@Model.GetUrl(1)">1</a></li>
            <li><span>.</span></li>
        }
        @foreach (var item in links)
        {
            if (item == Model.Page)
            {
                <li class="active"><span class="current" href="@Model.GetUrl(item)">@item</span></li>
            }
            else
            {
                <li><a href="@Model.GetUrl(item)">@item</a></li>
            }
        }
        @if (Model.Page + 1 != Model.PageCount && !links.Any(o => o == Model.PageCount))
        {
            <li><span>.</span></li>
            <li><a href="@Model.GetUrl(Model.PageCount)">@Model.PageCount</a></li>
        }
        @if (Model.HasNext)
        {
            <li><a href="@Model.GetUrl(Model.PageCount)">@Model.Next</a></li>
        }
    </ul>
}